package com.vehicle.service.imp;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.vehicle.bean.DataGridView;
import com.vehicle.bean.PageVo;
import com.vehicle.mapper.ApplyUseMapper;
import com.vehicle.pojo.ApplyUse;
import com.vehicle.service.SendCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SendCarServiceImpl implements SendCarService {

    @Autowired
    private ApplyUseMapper applyUseMapper;


    @Override
    public DataGridView findAllApplyUseByStatus(Integer deptid, PageVo pageVo) {
        PageHelper.startPage(pageVo.getPage(),pageVo.getLimit());
        List<ApplyUse> applyUseByStatus = applyUseMapper.findApplyUseByStatus(2, deptid);
        PageInfo pageInfo = new PageInfo<>(applyUseByStatus);
        DataGridView dataGridView = new DataGridView();
        dataGridView.setCount(pageInfo.getTotal());
        dataGridView.setData(applyUseByStatus);
        return dataGridView;
    }
}
